<?php

namespace App\Models\Post;

use App\Libraries\Easemob\Easemob;
use App\Libraries\Tools\URL;
use App\Models\BaseModel;
use App\Models\User\Follow;
use App\Models\User\User;
use Illuminate\Support\Facades\Auth;

class PostPurchase extends BaseModel
{

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $guarded = [];

    /**
     * The attributes excluded from the model's JSON form.
     *
     * @var array
     */
    protected $hidden = [];
    protected $table = 'post_purchase';

    protected $dateFormat = 'U';

    /**
     * @param $user_id
     * @param $post_id
     * @param $type
     * @param int $order_id
     * @param int $status
     * @return mixed
     */
    public function add($user_id, $post_id, $type, $order_id=0, $status=0){
        $this->user_id = $user_id;
        $this->post_id = $post_id;
        $this->type = $type;
        $this->order_id = $order_id;
        $this->status = $status;
        $this->save();
        return $this->id;
    }

}
